<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../lib/react.js"></script>
  <script src="../lib/react-dom.js"></script>
  <script src="http://cdn.bootcss.com/babel-core/5.8.38/browser.min.js"></script>
</head>
<body>
  <div id="app"></div>

  <script type="text/babel">
    var arr = ["a", 666, "jack"];
    
    // 注意：MyComponent首字母要大写
    // var MyComponent = React.createClass({
    //   render: function() { 
    //     return  <div> 
    //       { arr.map(function(item) { 
    //         return <div key={item}> hello,{ item }! </div> 
    //       }) } 
    //     </div>
    //   }});

    // ReactDOM.render(
    //   <MyComponent/>,
    //   document.getElementById("app")
    // )

    var Mycomponent = React.createClass({
      render: function() {
        return <div>
          {
            arr.map(item => {
              return <div key="item">hello,{item}!</div>
            })
          }
        </div>
      }
    });

    ReactDOM.render(
      <Mycomponent/>,
      document.querySelector("#app")
    )
  </script>
</body>
</html>

